<script>
	import config from './config'
	import store from '@/store'
	import {
		getToken
	} from '@/utils/auth'

	export default {
		onLaunch: function() {
			this.initApp()
		},
		methods: {
			// 初始化应用
			initApp() {
				// 初始化应用配置
				this.initConfig()
				this.checkLogin()
				// 检查用户登录状态
			},
			initConfig() {
				this.globalData.config = config
			},
			checkLogin() {
				try {
					const value = uni.getStorageSync('userData');
					if (value) {
						//有登录信息
						console.log("已登录用户：", value);
						//_this.$store.dispatch("setUserData",value); //存入状态
						uni.reLaunch({
							url: '../../pages/index/index',
						});
					}
				} catch (e) {
					// error
				}
			}
		}
	}
</script>

<style lang="scss">
	//#ifndef APP-PLUS-NVUE
	@import "uview-ui/index.scss";
	@import '@/static/scss/index.scss';
	//#endif
</style>